package com.sl.plugin.step.db;

import com.sl.core.engine.meta.ProcessCompDescriptorService;
import com.sl.core.engine.meta.impl.AbstractProcessCompDescriptor;
import com.sl.core.engine.meta.row.ProcessRowDescriptor;
import com.sl.core.engine.utils.BeanUtil;
import lombok.Getter;
import org.apache.hop.core.row.value.ValueMetaBigNumber;

import java.util.Map;

/**
 *
 */
@Getter
public class DbRemoveCompDescriptor extends AbstractProcessCompDescriptor<
        DbRemoveComp, DbRemoveCompContext> implements ProcessCompDescriptorService {


//    @Override
//    protected ProcessCompService getComp() {
//        return new DbQueryComp(this);
//    }
//
//    @Override
//    public ProcessCompContextService getContext() {
//        return new DbQueryCompContext();
//    }

    @Override
    public void loadDescriptor(Map<String, Object> map) {
        String dataSourceId = BeanUtil.getStr(map, "output.dataSourceId");
        String schemaId = BeanUtil.getStr(map, "output.schemaId");
        String tableName = BeanUtil.getStr(map, "output.tableName");


    }


    @Override
    public ProcessRowDescriptor getResultDescriptor(ProcessRowDescriptor rowDescriptor) {
        ProcessRowDescriptor result = new ProcessRowDescriptor(rowDescriptor);
        //设置返回值
        ValueMetaBigNumber bigNumber = new ValueMetaBigNumber();
        bigNumber.setName("rows");
        bigNumber.setComments("受影响行数");
        result.addValueMeta(bigNumber);
        return result;
    }
}
